package com.controller.rd;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.common.DateUtils;
import com.common.http.HttpResult;
import com.model.rd.SupplyDealVoModel;
import com.service.rd.OfferService;

import java.io.IOException;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletResponse;

/**
 * 报价书管理
 */
@Controller("rdOfferController")
@RequestMapping(value = "/api")
public class OfferController {

	static final Logger logger = LoggerFactory.getLogger(OfferController.class);
	@Autowired
	OfferService supplyOfferService;

	/**
	 * 查询详情
	 * 
	 * @param map
	 * @return
	 */
	@RequestMapping(value = "/rd/offer/selectOfferMmList", method = { RequestMethod.GET })
	@ResponseBody
	public HttpResult selectOfferMmList(@RequestParam String gramId, @RequestParam String infId) {
		return supplyOfferService.selectOfferMmList(gramId, infId);
	}

	/**
	 * 查询列表
	 * 
	 * @param map
	 * @return
	 */
	@RequestMapping(value = "/rd/offer/selectOfferList", method = { RequestMethod.POST })
	@ResponseBody
	public HttpResult selectOfferList(@RequestParam Map<String, Object> map) {
		return supplyOfferService.selectOfferList(map);
	}

	/**
	 * 保存
	 * 
	 * @param map
	 * @return
	 */
	@RequestMapping(value = "/rd/offer/saveOfferMm", method = { RequestMethod.POST })
	@ResponseBody
	public HttpResult saveOfferMm(@RequestBody SupplyDealVoModel purchaseSupplyOfferVO) {
		return supplyOfferService.saveOfferMm(purchaseSupplyOfferVO);
	}

	/**
	 * 提交
	 * 
	 * @param map
	 * @return
	 */
//	@RequestMapping(value = "/rd/offer/commitProgram", method = { RequestMethod.POST })
//	@ResponseBody
//	public HttpResult commitProgram(@RequestBody PurchaseSupplyOfferVO purchaseSupplyOfferVO) {
//		return supplyOfferService.commitOffer(purchaseSupplyOfferVO);
//	}

}
